package com.project.srtp.secure.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.project.srtp.secure.Enum.OperationType;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.Instant;

/**
* @author 曹行阳
* @date 2025/6/11 11:18
* @version 0.1
 * Database entity for a verifiable audit log.
 * This class combines the standardized log entry with its cryptographic proofs.
 * */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("t_audit_log")
public class AuditLogDO {

    @TableId(type = IdType.AUTO)
    private Long id;

    // --- Standardized Log Entry Fields ---
    private String userId;
    private OperationType opType;
    private Integer value;
    private Long timestamp; // Milliseconds
    private String deviceId;
    private String sessionId;
    private String metaData; // Stored as JSON or byte array representation

    // --- Cryptographic Proof Fields ---
    private String operationFingerprint; // F = BLAKE3(opData || Nonce)
    private String pedersenCommitment;   // C = g^F * h^r mod p
    private String rangeProof;           // Bulletproofs zero-knowledge proof
    private String blsSignature;         // BLS signature for integrity and non-repudiation

    private Instant createdAt;
}
